package com.lsq.wuyuge.controller;


//import io.swagger.annotations.Api;
import com.lsq.wuyuge.common.result.Result;
import com.lsq.wuyuge.dto.ArticleInfoDTO;
import com.lsq.wuyuge.dto.ArticlePublishDTO;
import com.lsq.wuyuge.service.IArticleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 文章表 前端控制器
 * </p>
 *
 * @author 一声闷雷
 * @since 2025-03-15
 */
@RestController
@RequestMapping("/article")
@Slf4j
//@Api(tags = "博客文章")
public class ArticleController {

    @Autowired
    private IArticleService articleService;

    /**
     * 创建文章
     * @return
     */
    @PostMapping("article")
    public Result<ArticleInfoDTO> createArticle(@RequestBody ArticlePublishDTO  articlePublishDTO){
        log.info("创建文章");
        ArticleInfoDTO articleInfo=articleService.addArticle(articlePublishDTO);
        return Result.success(articleInfo);
    }
}
